﻿<%@ Page Language="C#" MasterPageFile="~/Shared/MainPage.Master" AutoEventWireup="true" CodeBehind="InstrumentMaintainExtra.aspx.cs" Inherits="Runda.CMS.Portal.ContractFollowUp.InstrumentMaintainExtra" Title="维修配件" StylesheetTheme="GlobleTheme" %>

<%@ Register Assembly="RadGrid.Net2" Namespace="Telerik.WebControls" TagPrefix="rad" %>
<%@ Register Assembly="RadAjax.Net2" Namespace="Telerik.WebControls" TagPrefix="rad" %>
<%@ Register Assembly="RadWindow.Net2" Namespace="Telerik.WebControls" TagPrefix="rad" %>

<asp:Content ID="Content1" ContentPlaceHolderID="cphHead" runat="server">
  <link href="../Content/global.css" rel="stylesheet" type="text/css" />
    <script src="../Content/global.js" type="text/javascript"></script>
    <link href="../Content/Menu/Menu.css" rel="stylesheet" type="text/css" />
    <link href="../Content/Tab/tabs.css" rel="stylesheet" type="text/css" />

    <script src="../Content/jquery-1.3.2.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        function AddAccessory() {
            //检查配件是否已提交
            if (document.getElementById('<%=hiddenStatus.ClientID %>').value >= '1') {
                alert('配件已提交或核查，无法再添加更换配件!');
                return false;
            }
            radopen('AccessoryAdd.aspx?RegisterID=' + document.getElementById('<%=hiddenRegisterID.ClientID %>').value + '&MaintainID=' + document.getElementById('<%=hiddenMaintainID.ClientID %>').value, 'winAddAccessory');
            return false;
        }

        function OnAddAccessoryCallback(radWindow) {
            if (radWindow != undefined) {
                if (radWindow.Argument != '' && radWindow.Argument != null) {

                    RefreshItems();
                }
            }
        }

        function RefreshItems() {
            document.getElementById('<%=btnRefresh.ClientID %>').click();
        }

        function CheckForm() { 
            //检查配件是否已提交
            if (document.getElementById('<%=hiddenStatus.ClientID %>').value == '1') {
                alert('配件已提交!');
                return false;
            }
            //检查是否有配件
            if (document.getElementById('<%=hiddenHasAccessory.ClientID %>').value == '0') {
                alert('请添加配件及耗材!');
                return false;
            }
            //检查是否已填写读取
            return confirm('还未读取,确认提交吗?\r\n点击[是]则提交,点击[否]则取消');

        }
        //检查是否已填写读取
        function CheckRecord() {
            $.post('../Services/InstrumentRecordService.aspx', { MaintainID: $('#<%=hiddenMaintainID.ClientID %>').val() }, function(data, textStatus) {

                if (data.IsLogin) {
                    return true;
                }
                else {
                    return false;
                }
            }, 'json');
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphBody" runat="server">
 <rad:RadWindowManager ID="RadWindowManager1" runat="server">
    <Windows>  
        <rad:RadWindow ID="winAddAccessory" runat="server" Title="添加配件及耗材" Height="720px" Width="700px" ReloadOnShow="true" Modal="true" OnClientClose="OnAddAccessoryCallback"/> 
    </Windows>
</rad:RadWindowManager>

 <div class="area" id="areaForm" style="width:800px;height:400px;overflow:auto">
    <div style="margin: 5px 0 5px 0">
    </div>
    <table class="mnubar" cellspacing="0" cellpadding="0">
        <tbody>
            <tr>
                <td style="padding-left: 5px" nowrap>
                    <b>配件及耗材列表</b>
                </td>
                <td style="padding-left: 5px">
                    <img src="../Content/Grid/separator.gif">
                </td>
                <td class="icMenu" nowrap> 
                </td>
                <td class="icMenu mnuRight" nowrap>
                     <span class="menu"  onclick="return RefreshItems();">
                            <img class="mnuBtn" src="../Images/16_L_refresh.gif"><span class="mnuBtn">刷新</span></span>
                     <span class="menu"  onclick="return AddAccessory();">
                            <img class="mnuBtn" src="../Content/Grid/New_16_blue.gif"><span class="mnuBtn">添加配件及耗材</span></span>
                </td>
            </tr>
        </tbody>
    </table>
    
    <rad:RadGrid runat="server" ID="gridAccessoryList" Skin="OCM" AutoGenerateColumns="False" AllowSorting="True" GridLines="None"  
         EnableAJAX="True" EnableAJAXLoadingTemplate="True" ondeletecommand="gridAccessoryList_DeleteCommand" onitemdatabound="gridAccessoryList_ItemDataBound">
        <AJAXLoadingTemplate>
            <img src="../Images/loadding_orange.gif" /> 加载中...
        </AJAXLoadingTemplate>
        <ClientSettings EnableClientKeyValues="true">
            <Selecting AllowRowSelect="true" /> 
        </ClientSettings>
        <MasterTableView DataKeyNames="ReplacementID">  
            <Columns>
                <rad:GridBoundColumn DataField="AccessoryCode" HeaderText="物品识别号">
                </rad:GridBoundColumn>
                <rad:GridBoundColumn DataField="CompanyInstrumentCode" HeaderText="编号">
                </rad:GridBoundColumn>
                <rad:GridBoundColumn DataField="AccessoryName" HeaderText="名称"></rad:GridBoundColumn>
                 <rad:GridBoundColumn DataField="AccessoryType" HeaderText="类型"></rad:GridBoundColumn>
                 <rad:GridBoundColumn DataField="StockSource" HeaderText="来源"></rad:GridBoundColumn>
                 <rad:GridBoundColumn DataField="ReplacementNum" HeaderText="更换数量"></rad:GridBoundColumn>  
                 <rad:GridBoundColumn DataField="QuotePrice" HeaderText="报价金额"></rad:GridBoundColumn>
                 <rad:GridBoundColumn DataField="PaymentsObjectName" HeaderText="收费对象"></rad:GridBoundColumn> 
                 <rad:GridBoundColumn DataField="PaymentTypeName" HeaderText="收费类型"></rad:GridBoundColumn>  
                 <rad:GridTemplateColumn HeaderText="更换属于">
                 <ItemTemplate>
                     <asp:Label ID="lblBelongto" runat="server"></asp:Label>
                 </ItemTemplate>
                 </rad:GridTemplateColumn>
                   <rad:GridTemplateColumn HeaderText="类型">
                 <ItemTemplate>
                     <asp:Label ID="lblAccessoryPaymentStatus" runat="server"></asp:Label>
                 </ItemTemplate>
                 </rad:GridTemplateColumn>
                 <rad:GridTemplateColumn HeaderText="状态">
                 <ItemTemplate>
                     <asp:Label ID="lblCheckStatus" runat="server"></asp:Label>
                 </ItemTemplate>
                 </rad:GridTemplateColumn>
                 <rad:GridTemplateColumn HeaderText="操作">
                 <ItemTemplate> 
                     <asp:LinkButton ID="lnkbtnDelete" runat="server" CommandName="delete">删除</asp:LinkButton>
                 </ItemTemplate>
                 </rad:GridTemplateColumn> 
            </Columns>
        </MasterTableView>
    </rad:RadGrid>
    
        <div style="text-align:center;MARGIN-RIGHT: auto; MARGIN-LEFT: auto;">
    <asp:Button ID="btnSubmit" runat="server" Text="提交" onclick="btnSubmit_Click" CssClass="button" OnClientClick="return CheckForm();"/>
    <asp:Button ID="btnCheck" runat="server" Text="核查" onclick="btnCheck_Click" CssClass="button"/>
    </div>
    核查备注:<asp:TextBox ID="AccessoryReplaceMemo" runat="server" TextMode="MultiLine"  Height="40px"></asp:TextBox>
 </div>
    <asp:Button ID="btnRefresh" runat="server" Text="Button" style="display:none" onclick="btnRefresh_Click" />
                            <asp:HiddenField runat="server" ID="hiddenRegisterID" />  
                             <asp:HiddenField runat="server" ID="hiddenMaintainID" />
                             <asp:HiddenField runat="server" ID="hiddenStatus" />
                             <asp:HiddenField runat="server" ID="hiddenHasAccessory" /> 
</asp:Content>
